$(function(){
	/** ******************************************* */
	$("#sp_left1").click(function() {
		$("#sp_left1")
				.html("<img src='../image/img/sp_p2.jpg' width='60' height='80'/>");
		$("#sp_left2")
				.html("<a href'javascript:findMvBySort(2)'><img src='../image/img/sp_hot1.jpg' width='60' height='80'/></a>");
		$("#sp_left3")
				.html("<a href='javascript:findMvBySort(3)'><img src='../image/img/sp_new1.jpg' width='60' height='80'/></a>");
		$("#sp_left4")
				.html("<a href='javascript:findMvBySort(4)'><img src='../image/img/sp_p3.jpg' width='60' height='80'/></a>");
	});
	$("#sp_left2").click(function() {
		$("#sp_left2")
				.html("<img src='../image/img/sp_hot2.jpg' width='60' height='80'/>");
		$("#sp_left1")
				.html("<a href='javascript:findMvBySort(1)'><img src='../image/img/sp_p1.jpg' width='60' height='80'/></a>");
		$("#sp_left3")
				.html("<a href='javascript:findMvBySort(3)'><img src='../image/img/sp_new1.jpg' width='60' height='80'/></a>");
		$("#sp_left4")
				.html("<a href='javascript:findMvBySort(4)'><img src='../image/img/sp_p3.jpg' width='60' height='80'/></a>");
	});
	$("#sp_left3").click(function() {
		$("#sp_left3")
				.html("<img src='../image/img/sp_new2.jpg' width='60' height='80'/>");
		$("#sp_left2")
				.html("<a href='javascript:findMvBySort(2)'><img src='../image/img/sp_hot1.jpg' width='60' height='80'/></a>");
		$("#sp_left1")
				.html("<a href='javascript:findMvBySort(1)'><img src='../image/img/sp_p1.jpg' width='60' height='80'/></a>");
		$("#sp_left4")
				.html("<a href='javascript:findMvBySort(4)'><img src='../image/img/sp_p3.jpg' width='60' height='80'/></a>");
	});
	$("#sp_left4").click(function() {
		$("#sp_left4")
				.html("<img src='../image/img/sp_p4.jpg' width='60' height='80'/>");
		$("#sp_left3")
				.html("<a href='javascript:findMvBySort(3)'><img src='../image/img/sp_new1.jpg' width='60' height='80'/></a>");
		$("#sp_left2")
				.html("<a href='javascript:findMvBySort(2)'><img src='../image/img/sp_hot1.jpg' width='60' height='80'/></a>");
		$("#sp_left1")
				.html("<a href='javascript:findMvBySort(1)'><img src='../image/img/sp_p1.jpg' width='60' height='80'/></a>");
	});

	findSpecial(1,1);
	
});

function findMvBySort(flag){
	findSpecial(1,flag);
}

/**
 * 加载专辑
 */
function findSpecial(page,flag){
	$.post(path + "/song/findSpecial.do", {"page":page-1,"flag":flag}, function(result) {
		if (result.success) {
			$("#sp_right").empty();
			var list = result.data;
			$(list).each(function() {
				var div='<div id="sp_right1"><div id="sp_shead"><a href="/music/song/addSpecialSong.do?special_id='+this.special_id+'"><img src="../image/special/'+this.special_head+'" width="100" height="100"/></a></div><div id="sp_swrite"><span id="sp_span1">'+this.special_name+'</span><br/><span id="sp_span2">'+this.singer_name+'</span><br /> <span id="sp_span3">收藏:'+this.sp_house+'</span></div></div>';
				$("#sp_right").append(div);
				$("#sp_right div:last").data("special", this);
			});
		} else {
			alert(result.message);
		}
	});
}

